﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Shattered_Windows.OSVersioning
{
    class BindableOperatingSystem 
    {
        public string OsVersionLabel { get; private set; }
        public string OSXMLLabel { get; private set; }
        public OsVersion OsVersion { get; private set; }

        public string OsPlatformLabel { get; private set; }
        public OsPlatform OsPlatform { get; private set; }

        public string OsServicePackLabel { get; private set; }

        public BindableOperatingSystem()
        {
            OsServicePackLabel = Environment.OSVersion.ServicePack;

            switch (Environment.OSVersion.Version.ToString().Substring(0, 3))
                {
                    case "6.2":
                        OSXMLLabel = "Windows_8";
                        OsVersionLabel = "Microsoft Windows 8";
                        OsVersion = OsVersion.Windows8;
                        break;
                    case "6.1":
                        OSXMLLabel = "Windows_7";
                        OsVersionLabel = "Microsoft Windows 7";
                        OsVersion = OsVersion.Windows7;
                        break;
                    case "6.0":
                        OSXMLLabel = "Windows_Vista";
                        OsVersionLabel = "Microsoft Windows Vista";
                        OsVersion = OsVersion.WindowsVista;
                        break;
                    case "5.1":
                        OSXMLLabel = "Windows_XP";
                        OsVersionLabel = "Microsoft Windows XP";
                        OsVersion = OsVersion.WindowsXP;
                        break;
                    default:
                        OsVersionLabel = "UNSUPPORTED OPERATING SYSTEM";
                        OsVersion = OsVersion.Unsupported;
                        break;
                }

                if (Environment.Is64BitOperatingSystem)
                {
                    OsPlatformLabel = "x64";
                    OsPlatform = OsPlatform.x64;
                }
                else
                {
                    OsPlatformLabel = "x86";
                    OsPlatform = OsPlatform.x86;
                }
            
            
        }
    }
}
